import java.awt.Component;

import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JTable;
import javax.swing.ListCellRenderer;
import javax.swing.UIManager;
import javax.swing.table.JTableHeader;

/**
 * rowHeader.java - This class sets up the attributes of the Row Headers for each form.
 *   
 * @author Marc Vandehey
 */
@SuppressWarnings("serial")
public class rowHeader extends JLabel implements ListCellRenderer {

		/**
		 * rowHeaser constructor
		 * 
		 * @param table		takes in a table, and sets up row headers for it
	 	*/
		  rowHeader(JTable table) 
		  {
		    JTableHeader header = table.getTableHeader();
		    setOpaque(true);
		    setBorder(UIManager.getBorder("TableHeader.cellBorder"));
		    setHorizontalAlignment(CENTER);
		    setForeground(header.getForeground());
		    setBackground(header.getBackground());
		    setFont(header.getFont());
		  }

			/**
			 * Gets the info from the ListModel in Frame.java and attaches it to the frame 
			 * 
			 * @param list	a list of headers to be attached to the table
			 * @param value displays what will be put in the header
			 * @param the index of the row header
			 * @param isSelected if True, row is selected, false otherwise
			 * @param cellHasFocus True if the corresponding cell has focus, false otherwise
		 	*/
		  public Component getListCellRendererComponent(JList list, Object value,
		      int index, boolean isSelected, boolean cellHasFocus) 
		  {
		    setText((value == null) ? "" : value.toString());
		    return this;
		  }
}



